using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Microsoft.Xna.Framework.Content;

namespace Dracham.TileManagement.CharacterManagement
{
    public class ModelFactory
    {
        private static List<Model> models = new List<Model>();

        public static void Initialize(ContentManager content)
        {
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load("Data/Characters.xml");

            foreach (XmlNode node in xdoc.GetElementsByTagName("Character"))
            {
                models.Add(Model.FromXmlNode(node, content));
            }
        }

        public static Model GetModelById(String modelId)
        {
            foreach (Model m in models)
            {
                if (m.ModelId == modelId)
                {
                    return (Model)m.Clone();
                }
            }

            return null;
        }
    }
}
